﻿using Xejen.Communication.Soap.Extensions;
using Xejen.Communication.Soap.Communicator;
using Xejen.Communication.Soap.Configuration;
using Xejen.Hosting;
using Xejen.Hosting.Extensions;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Extensions.Logging;

namespace Xejen.Communication.Soap.Extensions
{
    /// <summary>
    /// 针对<see cref="IAppHost"/>进行扩展
    /// </summary>
    /// <creator>marc</creator>
    public static class AppHostExtensions
    {
        /// <summary>
        /// 启用Soap通讯
        /// </summary>
        /// <param name="host"><inheritdoc cref="IAppHost" path="/summary"/></param>
        /// <param name="configure">构建Soap通讯器的行为</param>
        /// <returns></returns>
        public static IAppHost UseSoapCommunication(this IAppHost host, Action<ISoapCommunicatorBuilder> configure)
        {
            var builder = new SoapCommunicatorBuilder(host);
            configure?.Invoke(builder);

            return host;
        }
    }
}
